package org.kfive.nova;

import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * Hello world!
 *
 */
public class  App
{
    public static void main( String[] args ) throws IOException {
        System.out.println( "Hello World!" );
        URL url = new URL("http://192.168.86.14/M00/00/3C/wKhWDlikFpeAYFOGAIN4T910_GA257.mp4");
        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
        connection.connect();
        BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
        byte[] buffer = new byte[1024];
        FileOutputStream fos = new FileOutputStream("d:\\shipin.mp4");
        int size=0;
        while ((size=bis.read(buffer))!=-1){
            fos.write(buffer,0,size);
        }
        fos.flush();
        fos.close();
        bis.close();
        connection.disconnect();
    }
}
